import {createBrowserRouter} from 'react-router-dom'
import App from '../App'
const routes=createBrowserRouter([
    {
        path:'/',
        element:<App/>,
        children:[
            {
                path:'home',
                async lazy(){
                    const {default:Home,loader} =await import ('../pages/home/Index')
                    return {
                        element :<Home/>,
                        loader
                    }
                }
            },
            {
                path:'todo',
                async lazy(){
                    const {default:Todo,loader} =await import ('../pages/todo/Index')
                    return {
                        element :<Todo/>,
                        loader
                    }
                }
            },
            {
                path:'message',
                async lazy(){
                    const {default:Message,loader} =await import ('../pages/message/Index')
                    return {
                        element :<Message/>,
                        loader
                    }
                }
            },
            {
                path:'my',
                async lazy(){
                    const {default:My,loader} =await import ('../pages/my/Index')
                    return {
                        element :<My/>,
                        loader
                    }
                }
            },
        ]
    },
    {
        path:'cart',
        async lazy(){
            const {default:Cart,loader} =await import ('../pages/cart/Index')
            return {
                element :<Cart/>,
                loader
            }
        }
    },
])
export default routes;